Skip to content

Completed CP-2#1182

Open
pratikb0501 wants to merge 1 commit into
super30admin:masterfrom
pratikb0501:master
Open

Completed CP-2#1182
pratikb0501 wants to merge 1 commit into
super30admin:masterfrom
pratikb0501:master

Conversation

@pratikb0501

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Interview Problem : Two elements sum to target (Problem1.py)

This submission does not address the Interview Problem: Two elements sum to target at all. The student appears to have submitted code for a different problem (0/1 Knapsack) by mistake.

To solve the Two Sum problem correctly, the student should:

  1. Implement a function that takes an array of integers (nums) and a target integer
  2. Find two indices i and j such that nums[i] + nums[j] == target
  3. Return these indices as an array

The reference solution uses a brute-force O(n²) approach with nested loops. A more optimized approach would use a hash map to achieve O(n) time complexity.

If this was a copy-paste error, please submit the correct solution for the Two Sum problem. If the student is learning dynamic programming, they should be aware that this is a different problem entirely.

VERDICT: NEEDS_IMPROVEMENT


Interview Problem: 0-1 Knapsack Problem (Problem2.py)

  1. Wrong Problem: The submitted solution solves "Two Sum" (LeetCode problem) instead of the "0-1 Knapsack Problem" that was assigned. This is a critical error.

  2. Language Mismatch: The file is named "Problem2.py" but contains Java code with class syntax. This would not execute as either language.

  3. Missing Knapsack Logic: The solution lacks any of the core Knapsack concepts:

    • No 2D DP table construction
    • No weight-value pair consideration
    • No capacity constraint handling
    • No decision-making between including/excluding items
  4. What was done well: The Two Sum solution (if that were the intended problem) is correctly implemented with proper HashMap usage and O(n) time complexity.

  5. Recommendation: The student needs to:

    • Read the problem statement carefully before solving
    • Implement the 0-1 Knapsack DP approach as shown in the reference
    • Ensure code matches the file extension (Java in .java file or Python in .py file)

VERDICT: NEEDS_IMPROVEMENT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants